<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单管理-车速递</title>
    <link rel="stylesheet" href="../static/css/bootstrap.min.css">
    <link rel="stylesheet" href="../static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../static/css/mymain.mymain.css">
    <script type="application/javascript" src="../static/js/jquery-3.3.1.js"></script>
    <script type="application/javascript" src="../static/js/bootstrap.min.js"></script>
    <script type="application/javascript" src="../static/layui/layui.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>

</head>
<body style="position: static">

<div id="app" class="bgGray">
    <div data-v-95ac8d30="" class="header3">
        <div data-v-95ac8d30="" class="layout clear">
            <div data-v-95ac8d30="" class="left logo">
                <a data-v-95ac8d30="" href="index.html">
                    <img data-v-95ac8d30=""
                         src="">
                </a>
            </div>
            <div data-v-95ac8d30="" class="header3Nav right">|<a data-v-95ac8d30="" href="mymain.html">我的订单</a>|<a
                    data-v-95ac8d30="" href="helpCenter.html">帮助中心</a>|<a data-v-95ac8d30="" href="/loginout">退出</a>
            </div>
            <div id="username" class="header3User right">
                <i data-v-95ac8d30="" class="iconfont icon-phone"></i>
                <span data-v-95ac8d30="" class="sp1">400-919-8000</span>
                <span  class="sp2">欢迎您，{{username}}</span>
                <span data-v-95ac8d30="" class="sp3"></span>
            </div>
        </div>
    </div>
    <div class="userInfo">
        <div class="layout">
            <div class="userInfoCom clear">
                <div class="userInfoL left">
                    <div data-v-1cae2c34="" class="userNav">
                        <dl data-v-1cae2c34="" class="userMsg">
                            <dt data-v-1cae2c34="">
                                <img data-v-1cae2c34=""
                                     src="">
                            </dt>
                            <dd data-v-1cae2c34="">
                                <p data-v-1cae2c34=""></p>
                                <p data-v-1cae2c34="" class="p5 pp" style="">普卡会员</p>
                            </dd>
                        </dl>
                        <ul data-v-1cae2c34="" class="manNav">
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="mymain.html" class="">订单管理</a>
                            </li>
                            <li data-v-1cae2c34="">
                                <a data-v-1cae2c34="" href="" class="sel">个人信息</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="userInfoR right">

                    <div class="orderManage manage">
                        <div class="orderManageTit manageTit clear">
                            <div class="left tit">个人信息</div>
                        </div>
                        <div class="site-demo-button" id="layerDemo" style="margin-bottom: 0;">
                            <div class="orderList list" id="noda">
                                <table class="tableinfo">
                                    <tr>
                                        <td>手机号：{{tel}}</td>
                                        <td>
                                            <button data-method="offset" data-type="auto"
                                                    class="layui-btn layui-btn-normal">修改
                                            </button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>邮箱：{{email}}</td>
                                        <td>
                                            <button data-method="upemail" data-type="auto"
                                                    class="layui-btn layui-btn-normal">修改
                                            </button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td></td>
                                        <td>
                                            <button data-method="uppassword" data-type="auto"
                                                    class="layui-btn layui-btn-normal">修改密码
                                            </button>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div data-v-3aaf9db2="" class="footer2">
        <div data-v-3aaf9db2="" class="layout clear">
            <div data-v-3aaf9db2="" class="d1">
                <a data-v-3aaf9db2="" href="about.html">关于车速递</a></div>
        </div>
    </div>

</div>

<script type="text/javascript">

    var daohang = new Vue({
        el:'#username',
        data:{
            username:'',
        },
        mounted:function (){
            $.ajax({
                url:'/loginName',
                type:'get',
                success:function (res){
                    daohang.username=res;
                }
            })
        }
    });


    var vm = new Vue({
        el: '#noda',
        data: {
            tel: '',
            email: ''
        },
    });

    $(function () {
        $.ajax({
            type: "get",
            url: "/user",
            dataType: "json",
            success: function (data) {
                //id为0时为父类
                vm.tel = data.tel;
                vm.email = data.email;
            }
        });
    })

</script>


<script>
    layui.use('layer', function () { //独立版的layer无需执行这一句
        var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句

        //触发事件
        var active = {
            setTop: function () {
                var that = this;
                //多窗口模式，层叠置顶
            }
            , offset: function (othis) {
                var type = othis.data('type')
                    , text = othis.text();

                layer.open({
                    type: 1
                    ,
                    offset: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    ,
                    id: 'layerDemo' + type //防止重复弹出
                    ,
                    content: '<div style="text-align: center; width: 300px; height: 50px;padding-top: 20px"><form>新手机：<input type="text" name="tel" id="tel"></form></div>'
                    ,
                    btn: '修改'
                    ,
                    btnAlign: 'c' //按钮居中
                    ,
                    shade: 0 //不显示遮罩
                    ,
                    yes: function () {
                        $.ajax({
                            url: "/info",
                            type: "get",
                            data: $("form").serialize(),
                            dataType: 'json',
                            success: function (res) {
                                console.log(res);
                                if (res.code == 1) {
                                    alert(res.info);
                                    window.location.href = ("myinfo.html");
                                } else {
                                    layer.alert(res.info);
                                }
                            },
                            error: function () {
                                alert("ajax错误");
                            }
                        });
                    }
                });
            }
            , upemail: function (othis) {
                var type = othis.data('type')
                    , text = othis.text();

                layer.open({
                    type: 1
                    ,
                    upemail: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    ,
                    id: 'layerDemo' + type //防止重复弹出
                    ,
                    content: '<div style="text-align: center; width: 300px; height: 50px;padding-top: 20px"><form>新邮箱：<input type="text" name="email" id="email"></form></div>'
                    ,
                    btn: '修改'
                    ,
                    btnAlign: 'c' //按钮居中
                    ,
                    shade: 0 //不显示遮罩
                    ,
                    yes: function () {
                        $.ajax({
                            url: "/info",
                            type: "get",
                            data: $("form").serialize(),
                            dataType: 'json',
                            success: function (res) {
                                console.log(res);
                                if (res.code == 1) {
                                    alert(res.info);
                                    window.location.href = ("myinfo.html");
                                } else {
                                    alert(res.info);
                                }
                            },
                            error: function () {
                                alert("ajax错误");
                            }
                        });
                    }
                });
            }, uppassword: function (othis) {
                var type = othis.data('type')
                    , text = othis.text();

                layer.open({
                    type: 1
                    ,
                    uppassword: type //具体配置参考：http://www.layui.com/doc/modules/layer.html#offset
                    ,
                    id: 'layerDemo' + type //防止重复弹出
                    ,
                    content: '<form><div style="text-align: center; width: 300px; height: 50px;padding-top: 20px">原密码：<input type="password" name="oldpassword" id="oldpassword"></div>' +
                        '<div style="text-align: center; width: 300px; height: 50px;">新密码：<input type="password" name="newpassword" id="newpassword"></div></form>'
                    ,
                    btn: '修改'
                    ,
                    btnAlign: 'c' //按钮居中
                    ,
                    shade: 0 //不显示遮罩
                    ,
                    yes: function () {
                        $.ajax({
                            url: "/info",
                            type: "get",
                            data: $("form").serialize(),
                            dataType: 'json',
                            success: function (res) {
                                console.log(res);
                                if (res.code == 1) {
                                    alert(res.info);
                                    window.location.href = ("myinfo.html");
                                } else {
                                    layer.alert(res.info);
                                }
                            },
                            error: function () {
                                alert("ajax错误");
                            }
                        });
                    }
                });
            },

        };

        $('#layerDemo .layui-btn').on('click', function () {
            var othis = $(this), method = othis.data('method');
            active[method] ? active[method].call(this, othis) : '';
        });

    });
</script>


</body>
</html>dy>
</html>